# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/29 下午4:58
 @Author  : tgy
 
"""
from person import Person, Manager


def list_attrs(obj: object):
    ...
    for k, v in obj.__dict__.items():
        yield (k, v)
    yield from get_class_attr(obj.__class__)


def get_class_attr(cla):
    for k, v in cla.__dict__.items():
        yield (k, v)

    for cl in cla.__bases__:
        yield from get_class_attr(cl)


if __name__ == '__main__':
    ...
    print(Person.__class__)
    manager = Manager('zhangsan', 'it', 100)
    for v, k in list_attrs(manager):
        print(f'{v}:{str(k)}')
